﻿using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Spatial.Euclidean;

namespace FDEE.Model
{
    class CPE21 : CPEBase
    {
        Dictionary<double, List<int>> dic = new Dictionary<double, List<int>>();
        Dictionary<double, List<int>> addDic = new Dictionary<double, List<int>>();
        bool isAdd = false;
        int mainDBdia;
        Dictionary<string, int[]> dicRInfo = new Dictionary<string, int[]>();
        List<int> three_a = new List<int>() { 395, 398, 409, 426, 446, 472, 501, 536, 575, 619 };
        List<int> three_b = new List<int>() { 270, 274, 282, 292, 305, 322, 342, 365, 392, 422 };
        eDB rebarDB = eDB.DB28;//5号加强筋

        /// <summary>
        /// 
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="pierNumber"></param>
        /// <param name="ct"></param>
        /// <param name="st"></param>
        /// <param name="W">宽</param>
        /// <param name="L">长</param>
        /// <param name="hh"></param>
        /// <param name="rr"></param>
        /// <param name="up"></param>
        /// <param name="low"></param>
        /// <param name="mainDB"></param>
        /// <param name="wwside">宽对应变化长度（宽两端varies）</param>
        /// <param name="llside">长对应变化长度（长两端varies）</param>
        /// <param name="outr"></param>
        /// <param name="innerr"></param>
        /// <param name="sider"></param>
        /// <param name="topLength">顶部宽度</param>


        internal CPE21(string typeName, string pierNumber, eColumnType ct, eSubType st,
            int ww, int ll, int hh,  double up, double low,
            eDB mainDB, double wwside, double llside, double outr, double innerr, double sider,double topLength)
            : base(typeName, pierNumber, ct, st, ww, ll, hh, up, low,outr,innerr,sider, mainDB,wwside,llside, topLength)
        {
            mainDBdia = (int)mainDB;
        }

        /// <summary>
        /// 起步截面布筋均分
        /// </summary>
        public override void SetRebarDistribute()
        {
            double d1, d2;
            double d1r, d2r;
            switch (SubType)
            {
                case eSubType.B:
                    d1 = (Length - 2 * llSide - mainDBdia ) / 3;
                    d2 = (Width - 2 * wwSide - mainDBdia ) / 6;
                    dicRInfo = new Dictionary<string, int[]>();
                    //I,II截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 6);

                    dicRInfo.Add("4.1.a", new int[] { 4811, 3239, 113, 4 });
                    dicRInfo.Add("4.1.b", new int[] { 4811, 3247, 113, 4 });
                    dicRInfo.Add("4.2.a", new int[] { 5665, 3162, 248, 4 });
                    dicRInfo.Add("4.2.b", new int[] { 6140, 3134, 311, 4 });
                    dicRInfo.Add("4.2.c", new int[] { 39212, 3003, 509, 4 });
                    dicRInfo.Add("4.2.d", new int[] { 117503, 3000, 570, 4 });
                    dicRInfo.Add("4.3.a", new int[] { 5190, 3201, 183, 4 });
                    dicRInfo.Add("5.1", new int[] { 9905, 3048, 346, 4 });
                    dicRInfo.Add("5.2", new int[] { 11773, 3034, 403, 4 });
                    dicRInfo.Add("5.3", new int[] { 14574, 3021, 459, 4 });
                    three_a = new List<int>() { 395, 398, 409, 426, 446, 472, 501, 536, 575, 619 };
                    three_b = new List<int>() { 270, 274, 282, 292, 305, 322, 342, 365, 392, 422 };
                    break;
                case eSubType.BM:
                    rebarDB = eDB.DB28;                   

                    d1 = (Length - 2 * llSide - mainDBdia) / 3;
                    d2 = (Width - 2 * wwSide - mainDBdia) / 6;
                    dicRInfo = new Dictionary<string, int[]>();
                    //I,II截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 6);

                    dicRInfo = new Dictionary<string, int[]>();
                    //I,II截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 7);
                    dicRInfo.Add("4.1.a", new int[] { 4811, 3239, 116, 4 });
                    dicRInfo.Add("4.1.b", new int[] { 4811, 3247, 116, 4 });
                    dicRInfo.Add("4.2.a", new int[] { 5664, 3162, 251, 4 });
                    dicRInfo.Add("4.2.b", new int[] { 6004, 3141, 317, 4 });
                    dicRInfo.Add("4.2.c", new int[] { 28983, 3005, 513, 4 });
                    dicRInfo.Add("4.2.d", new int[] { 45496, 3002, 572, 2 });
                    dicRInfo.Add("4.3.a", new int[] { 5189, 3199, 186, 4 });
                    dicRInfo.Add("5.1", new int[] { 7726, 3081, 362, 4 });
                    dicRInfo.Add("5.2", new int[] { 8463, 3067, 421, 4 });
                    dicRInfo.Add("5.3", new int[] { 12938, 3067, 421, 4 });
                    dicRInfo.Add("5.4", new int[] { 45496, 3002, 572, 2 });
                    three_a = new List<int>() { 312, 321, 337, 358, 386, 421, 461, 508, 561, 620 };
                    three_b = new List<int>() { 171, 178, 190, 206, 228, 255, 288, 326, 371, 422 };
                    break;
                case eSubType.CM:
                    d1 = (Length - 2 * llSide - mainDBdia  - 24) / 3;
                    d2 = (Width - 2 * wwSide - mainDBdia  - 24) / 7;
                    dicRInfo = new Dictionary<string, int[]>();
                    //I,II截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 7);
                    dicRInfo.Add("4.1.a", new int[] { 4811, 3239, 113, 4 });
                    dicRInfo.Add("4.1.b", new int[] { 4811, 3247, 113, 4 });
                    dicRInfo.Add("4.2.a", new int[] { 5667, 3162, 248, 4 });
                    dicRInfo.Add("4.2.b", new int[] { 6142, 3134, 311, 4 });
                    dicRInfo.Add("4.2.c", new int[] { 39170, 3003, 509, 4 });
                    dicRInfo.Add("4.2.d", new int[] { 117356, 3000, 570, 4 });
                    dicRInfo.Add("4.3.a", new int[] { 5191, 3201, 183, 4 });
                    dicRInfo.Add("5.1", new int[] { 9902, 3048, 346, 4 });
                    dicRInfo.Add("5.2", new int[] { 11772, 3034, 403, 4 });
                    dicRInfo.Add("5.3", new int[] { 14579, 3021, 459, 4 });
                    three_a = new List<int>() { 395, 398, 409, 426, 446, 472, 501, 536, 575, 619 };
                    three_b = new List<int>() { 270, 274, 282, 292, 305, 322, 342, 365, 392, 422 };
                    break;
            }
        }

        public  void SetRebarDistributeNew(double Length,double Width)
        {
            double d1, d2;
            double d1r, d2r;
            switch (SubType)
            {
                case eSubType.B:
                    d1 = (Length- mainDBdia) / 3;
                    d2 = (Width - mainDBdia) / 6;
                    dicRInfo = new Dictionary<string, int[]>();
                    //I,II截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 6);
                 
                    break;
                case eSubType.BM:
                    rebarDB = eDB.DB28;

                    d1 = (Length  - mainDBdia) / 3;
                    d2 = (Width  - mainDBdia) / 6;
                    //I,II截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 6);
                    break;
                case eSubType.CM:
                    d1 = (Length  - mainDBdia) / 3;
                    d2 = (Width - mainDBdia) / 7;
                    //I,II截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 7);
                    
                    break;
            }
        }
        /// <summary>
        /// III截面布筋均分
        /// </summary>
        /// <param name="W">宽</param>
        /// <param name="L">长</param>
        /// <param name="wwS">宽对应变化长度（宽两端varies）</param>
        /// <param name="llS">长对应变化长度（长两端varies）</param>
        public void SetRebarDistributeIII(double W, double L, double wwS, double llS)
        {
            double d1, d2;
            double d1r, d2r;
            switch (SubType)
            {
                case eSubType.B:

                    d1 = (L - 2 * llS - mainDBdia) / 3;
                    d2 = (W - 2 * wwS - mainDBdia) / 13;

                    //III截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1,3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 13);

                    break;
                case eSubType.BM:

                    d1 = (L - 2 * llS - mainDBdia) / 3;
                    d2 = (W - 2 * wwS - mainDBdia) / 13;

                    //III截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 13);

                    break;
                case eSubType.CM:

                    d1 = (L - 2 * llS - mainDBdia  - 24) / 3;
                    d2 = (W - 2 * wwS - mainDBdia  - 24) / 13;

                    //III截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 13);

                    break;
            }
        }

        public void SetRebarDistributeIIINew( double L, double W)
        {
            double d1, d2;
            double d1r, d2r;
            switch (SubType)
            {
                case eSubType.B:

                    d1 = (L - mainDBdia) / 3;
                    d2 = (W  - mainDBdia) / 13;

                    //III截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 13);

                    break;
                case eSubType.BM:

                    d1 = (L  - mainDBdia) / 3+1;
                    d2 = (W  - mainDBdia) / 13+1;

                    //III截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 13);

                    break;
                case eSubType.CM:

                    d1 = (L - mainDBdia ) / 3;
                    d2 = (W  - mainDBdia) / 13;

                    //III截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 13);

                    break;
            }
        }
        /// <summary>
        /// VI截面布筋均分
        /// </summary>
        /// <param name="W">宽</param>
        /// <param name="L">长</param>
        /// <param name="wwS">宽对应变化长度（宽两端varies）</param>
        /// <param name="llS">长对应变化长度（长两端varies）</param>
        public void SetRebarDistributeIV(double W, double L,  double wwS,double llS)
        {
            double d1, d2;
            double d1r, d2r;
            switch (SubType)
            {
                case eSubType.B:
                    d1 = (L - 2 * llS - mainDBdia) / 3;
                    d2 = (W - 2 * wwS - mainDBdia) / 17;
                    //IV截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 17);
                    break;
                case eSubType.BM:
                    d1 = (L - 2 * llS - mainDBdia) / 3;
                    d2 = (W - 2 * wwS - mainDBdia) / 17;
                    //IV截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 17);
                    break;
                case eSubType.CM:
                    d1 = (L - 2 * llS - mainDBdia -100) / 3;
                    d2 = (W - 2 * wwS - mainDBdia - 100) / 17;
                    //IV截面参数
                    MainLBarDistribute = new RebarTendonDistribute(12, d1, 3);
                    MainWBarDistribute = new RebarTendonDistribute(12, d2, 17);
                    break;
            }
        }
        public override void SetRebarList()
        {

            #region 0-箍筋
            int npts = GetStirrupNum()+3;

            int a = 0, b = 0, c = 0;
            //1号筋
            CalPara(Width, Length, wwSide, llSide, ref a, ref b, ref c);
           
            RebarList.Add(new MRORebarRecord(1, 0, "", eDB.DB12, npts, eShapeType.MRO, a, b, c));         
            //箍筋变化筋数量
            int num = (int)LenUpper / 300;
            double r1 = 0;
            double r0 = 0;
            double r2 = 0;
            double x = 0;
            double y = 0;
            double xI = 0;
            double yI = 0;
            double xS = 0;
            double yS = 0;
            CalArcCenter(1750 - Width * 0.5, 0, 0, 3000, OuterRadius, 0, ref r1, ref x, ref y);
            CalArcCenter(1750 - Width * 0.5 + wwSide, 0, 0, 3000, InnerRadius, 0, ref r0, ref xI, ref yI);
            CalArcCenter(450 - llSide, 0, 0, 3000, SideRadius, 0, ref r2, ref xS, ref yS);

            for (int m = 1; m <= num; m++)
            {
                
                double h0 = 300 * m * 0.001;
                if (m >= 8)
                    h0 = 300 * m * 0.001 - 3 * 0.001;
                //double w = 2 * GetXByH(h0) * 1000;

                //double wwS = 1000 * (GetXByH(h0) - GetX2ByH(h0));
                //double llS = Length * 0.5 - 1000 * GetSideXByH(h0);
                double w = 2 * GetXByH(x * 0.001, y * 0.001, h0) * 1000;
                double wwS = 1000 * (GetXByH(x * 0.001, y * 0.001, h0) - GetX2ByH(xI * 0.001, yI * 0.001, h0));
                double llS = Length * 0.5 - 1000 * GetSideXByH(xS * 0.001, yS * 0.001, h0);
                CalPara(Math.Round(w, 0, MidpointRounding.AwayFromZero), Length, Math.Round(wwS, 0, MidpointRounding.AwayFromZero), Math.Round(llS, 0, MidpointRounding.AwayFromZero), ref a, ref b, ref c);
                if (m != num)
                    RebarList.Add(new MRORebarRecord(1, m, "", eDB.DB12, 1, eShapeType.MRO, a, b, c));
                else
                {
                    a = Length - 50 * 2 - 2 * 12;
                    c = (int)TopLength - 50 * 2 - 2 * 12;
                    RebarList.Add(new MRRebarRecord(1, m, "", eDB.DB12, 1, eShapeType.MR, a, c));
                }
            }
            CalPara(Width, Length, wwSide, llSide, ref a, ref b, ref c);
            SetRebarDistributeNew(a, c);
            //2号筋
            RebarList.Add(new MORebarRecord(2, 0, "", eDB.DB12, npts, eShapeType.MO, Width - 100 - 24, (int)MainLBarDistribute.Location[1] * -2 + mainDBdia+1));



            RebarCollection RebarList3a = new RebarCollection();//3a集合
            RebarCollection RebarList3b = new RebarCollection();//3b集合

            for (int m = 1; m <= num; m++)
            {
                //double h0 = 300 * m * 0.001;
                //double w = 2 * GetXByH(h0) * 1000;
                //double w2 = 2 * GetX2ByH(h0) * 1000;
                //double wwS = 1000 * (GetXByH(h0) - GetX2ByH(h0));
                //double llS = Length * 0.5 - 1000 * GetSideXByH(h0);
                
                double h0 = 300 * m * 0.001;
                if (m >= 8)
                    h0 = 300 * m * 0.001 - 3 * 0.001;
                double w = 2 * GetXByH(x * 0.001, y * 0.001, h0) * 1000;
                double w2 = 2 * GetX2ByH(xI * 0.001, yI * 0.001, h0) * 1000;
                double wwS = 1000 * (GetXByH(x * 0.001, y * 0.001, h0) - GetX2ByH(xI * 0.001, yI * 0.001, h0));
                double llS = Length * 0.5 - 1000 * GetSideXByH(xS * 0.001, yS * 0.001, h0);
                CalPara(Math.Round(w, 0, MidpointRounding.AwayFromZero), Length, Math.Round(wwS, 0, MidpointRounding.AwayFromZero), Math.Round(llS, 0, MidpointRounding.AwayFromZero), ref a, ref b, ref c);
                if (m == 10)
                {
                    llS = 0;
                    wwS = 0;
                    w = TopLength;
                    //SetRebarDistributeIV(w - 100, Length - 100 + 24, wwS, llS);
                    RebarList3a.Add(new MORebarRecord(3, m, "a", eDB.DB12, 1, eShapeType.MO, Length - 100 - 24, three_a[m - 1]));
                    RebarList3b.Add(new MORebarRecord(3, m, "b", eDB.DB12, 2, eShapeType.MO, Length - 100 - 24, three_b[m - 1]));
                    SetRebarDistributeIIINew(Length - 100 - 24, w - 100 - 24);
                    if (SubType == eSubType.BM)
                        RebarList.Add(new MORebarRecord(2, m, "", eDB.DB12, 1, eShapeType.MO, (int)w - 100 - 24, (int)MainLBarDistribute.Location[1] * -2 + mainDBdia-2));
                    else if (SubType == eSubType.CM)
                        RebarList.Add(new MORebarRecord(2, m, "", eDB.DB12, 1, eShapeType.MO, (int)w - 100 - 24, (int)MainLBarDistribute.Location[1] * -2 + mainDBdia));
                    else
                        RebarList.Add(new MORebarRecord(2, m, "", eDB.DB12, 1, eShapeType.MO, (int)w - 100 - 24 , (int)MainLBarDistribute.Location[1] * -2 + mainDBdia));

                }
                else
                {
                    SetRebarDistributeIIINew(a,c);
                    if (SubType == eSubType.CM)
                    {
                        RebarList3a.Add(new MORebarRecord(3, m, "a", eDB.DB12, 1, eShapeType.MO, Length - 100 - 24, three_a[m - 1]));
                        RebarList3b.Add(new MORebarRecord(3, m, "b", eDB.DB12, 2, eShapeType.MO, Length - 100 - 24, three_b[m - 1]));
                    }
                    else if (SubType == eSubType.D)
                    {
                        RebarList3a.Add(new MORebarRecord(3, m, "a", eDB.DB12, 1, eShapeType.MO, Length - 100 - 24, three_a[m - 1]));
                        RebarList3b.Add(new MORebarRecord(3, m, "b", eDB.DB12, 2, eShapeType.MO, Length - 100 - 24, three_b[m - 1]));

                    }
                    else
                    {
                        RebarList3a.Add(new MORebarRecord(3, m, "a", eDB.DB12, 1, eShapeType.MO, Length - 100 - 24, three_a[m - 1]));
                        RebarList3b.Add(new MORebarRecord(3, m, "b", eDB.DB12, 2, eShapeType.MO, Length - 100 - 24, three_b[m - 1]));
                    }
                    RebarList.Add(new MORebarRecord(2, m, "", eDB.DB12, 1, eShapeType.MO, (int)w - 100 - 24 , (int)MainLBarDistribute.Location[1] * -2 + mainDBdia+1));

                }
            }

            SetRebarDistribute();
            //RebarList.Add(new MORebarRecord(3, 0, "", eDB.DB12, npts * 2, eShapeType.MO, Length - 100 - 24, MainWBarDistribute.Distance(1, 2) + 12 * 2));
            if (SubType == eSubType.CM)
                RebarList.Add(new MORebarRecord(3, 0, "", eDB.DB12, npts * 2, eShapeType.MO, Length - 100 - 24, 120*2+28));
            else
                RebarList.Add(new MORebarRecord(3, 0, "", eDB.DB12, npts * 2, eShapeType.MO, Length - 100 - 24, MainWBarDistribute.Distance(1, 2) + 12 * 2 + MainLBarDistribute.Location.Count - 1));
            foreach (var item in RebarList3a)
            {
                RebarList.Add(item);
            }
            foreach (var item in RebarList3b)
            {
                RebarList.Add(item);
            }
            #endregion
            #region 主筋  
            bool isDiv = false;
            bool isToTop = false;
            //  1-获取承台尺寸
            FootingBase theFooting = MemberFactory.CreatMember(MemberFactory.FromColumnToFooting(ColumnType), SubType);
            int FTHeight = theFooting.Height;
            int FTWidth = theFooting.Width;
            int FTLen = theFooting.Length;
            int db = (int)MainRebarDB;
            //  2-确定分段
            // 起步钢筋距承台底面160；
            double x0 = TopLength * 0.5 - 0.5 * Width + mainDBdia * 0.5 + 50 + 12;
            double x1 = GetXByH(1.5) * 1000 + mainDBdia * 0.5 + 50 + 12;
            double x2 = 0;


            PEArc OuterArc = new PEArc(new Point2D(x0, 0), new Point2D(x1, 1500), new Point2D(x2, 3000 - 50 - mainDBdia * 0.5 - 12));
            //double Lmax = 1200 + OuterArc.Length + (PierHeight - LenUpper) + (FTHeight - 160) + 600 - 3 * mainDBdia;

            int[] value = dicRInfo.Values.ToList()[0];

            int arcR = value[0];
            int arcLength = value[1];
            int arcC = value[2];
            int arcNum = value[3];
            double Lmax = 1500 + arcLength + (PierHeight - LenUpper) + (FTHeight - 160) + 600 - 3 * mainDBdia;
            if (MainRebarDB == eDB.DB28)
                Lmax = 1200 + arcLength + (PierHeight - LenUpper) + (FTHeight - 160) + 600 - 3 * mainDBdia;
            int NumMainAll = 0;
            if (Lmax <= 12000)
            {
                isToTop = true;
                foreach (var item in dicRInfo.Keys)
                {
                    value = dicRInfo[item];
                    int arcr = value[0];
                    int arclength = value[1];
                    int arcc = value[2];
                    int arcnum = value[3];
                    int rr = RebarKnowledge.GerRadius(eDB.DB32);
                    int l = (int)((PierHeight - LenUpper) + (FTHeight - 160));
                    int A = 600;        //固定      
                    int B = 45;         //固定
                    int F = 1500 - arcc;
                    if (MainRebarDB == eDB.DB28)
                        F = 1200 - arcc;
                    string[] va = item.Split('.');
                    //eDB rebarDB = MainRebarDB;
                    rr = arcr;
                    if (int.Parse(va[0]) == 5)
                    {
                        //rebarDB = eDB.DB28;
                        value = dicRInfo[item];

                        int bb = arclength;
                        int cc = arcc;
                        //int arcnum = value[3];
                        int dd = 1500 - cc;
                        if (rebarDB == eDB.DB28)
                            dd = 1200 - cc;

                        //F = 1200 - arcc;
                        if (va.Length == 1)
                            RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), 0, "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
                        else if (va.Length == 2)
                            RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[1]), "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
                        else if (va.Length == 3)
                            RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[1]), va[2], rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));

                    }
                    else
                    {
                        if (va.Length == 1)
                        {
                            RebarList.Add(new MKLRebarRecord(int.Parse(va[0]), 0, "", MainRebarDB, arcnum, eShapeType.MKL, A, l, arclength, arcc, F, rr));
                        }
                        else if (va.Length == 2)
                        {
                            if (int.Parse(va[1]) > 1)
                                RebarList.Add(new MKLRebarRecord(int.Parse(va[0]), int.Parse(va[1]), "", MainRebarDB, arcnum, eShapeType.MKLM, A, l, arclength, arcc, F, rr));
                            else
                                RebarList.Add(new MKLRebarRecord(int.Parse(va[0]), int.Parse(va[1]), "", MainRebarDB, arcnum, eShapeType.MKL, A, l, arclength, arcc, F, rr));
                        }
                        else if (va.Length == 3)
                        {
                            if (int.Parse(va[1]) > 1)
                                RebarList.Add(new MKLRebarRecord(int.Parse(va[0]), int.Parse(va[1]), va[2], MainRebarDB, arcnum, eShapeType.MKLM, A, l, arclength, arcc, F, rr));
                            else
                                RebarList.Add(new MKLRebarRecord(int.Parse(va[0]), int.Parse(va[1]), va[2], MainRebarDB, arcnum, eShapeType.MKL, A, l, arclength, arcc, F, rr));
                        }
                    }
                }
            }
            else
            {

                int NumOFout = MainLBarDistribute.Location.Count * 2 + 4;
                NumMainAll = MainWBarDistribute.Location.Count * 2 + NumOFout;
                // 判断起步筋定尺7m或9m，判断依据是花瓶主筋的A值应不小于2400
                double LStartMax = 600 + (PierHeight - LenUpper + (FTHeight - 160) - 3 * mainDBdia);
                double L1 = 8483;
                L1 = 8494;
                int len = 9000;
                if (LStartMax > 9000)
                {
                    // 起步筋定尺9m
                    //4.1a为内侧起步筋；
                    RebarList.Add(new MHXRebarRecord(4, 1, "", MainRebarDB, false, NumOFout - 4, eShapeType.MHXe, 9000, 1800));

                    RebarList.Add(new MHXRebarRecord(4, 2, "", MainRebarDB, true, NumMainAll - NumOFout, eShapeType.MHX, 9000, 1800));
                    //5.1b为外侧起步筋；
                    RebarList.Add(new MHXRebarRecord(4, 3, "", MainRebarDB, true, 4, eShapeType.MHXe, 9000, 1800));
                }
                else if (LStartMax > 7000)
                {
                    // 起步筋定尺7m
                    //4.1a为内侧起步筋；
                    RebarList.Add(new MHXRebarRecord(4, 1, "", MainRebarDB, false, NumOFout - 4, eShapeType.MHXe, 7000,1800));

                    RebarList.Add(new MHXRebarRecord(4, 2, "", MainRebarDB, true, NumMainAll - NumOFout, eShapeType.MHX, 7000, 1800));
                    //5.1b为外侧起步筋；
                    RebarList.Add(new MHXRebarRecord(4, 3, "", MainRebarDB, true, 4, eShapeType.MHXe, 7000, 1800));
                    len = 7000;
                    L1 = 6483;
                    L1 = 6494;
                }
                else if (LStartMax >= 600 + 2400 + (FTHeight - 160) - 3 * mainDBdia)
                {
                    // 起步筋搭接位置不合适
                    throw new Exception("起步筋搭接位置不合适，花瓶墩过矮");
                }
                int A = 600;        //固定      
                int C = 45;         //固定
                int D = 1800;       //固定
                int L = len;       //固定
                int r = RebarKnowledge.GerRadius(MainRebarDB);
                int d = (int)MainRebarDB;
                int B = L - A - C - D + r / 2 + d;
                Lmax = 1500 + OuterArc.Length + (PierHeight - LenUpper) + (FTHeight - 160) - L1 + 1200;
                if (MainRebarDB == eDB.DB28)
                    Lmax = 1200 + OuterArc.Length + (PierHeight - LenUpper) + (FTHeight - 160) - L1 + 1200;
                if (Lmax <= 12000)
                {

                    // 分两段
                    double LConst = PierHeight - LenUpper;
                    int aa = (int)Math.Round(LConst + FTHeight - 160 - B - 32, 0, MidpointRounding.AwayFromZero);
                    int bb = arcLength;// (int)Math.Round(arc.Length, 0, MidpointRounding.AwayFromZero);
                    int cc = arcC;// 305;
                    int dd = 1500 - arcC;// 1195;
                    if (MainRebarDB == eDB.DB28)
                        dd = 1200 - arcC;
                    int rr = arcR;// (int)Math.Round(arc.Radius, 0, MidpointRounding.AwayFromZero);
                    foreach (var item in dicRInfo.Keys)
                    {
                        value = dicRInfo[item];
                        int arcr = value[0];
                        bb = value[1];
                        cc = value[2];
                        int arcnum = value[3];
                        dd = 1500 - cc;
                        if (MainRebarDB == eDB.DB28)
                            dd = 1200 - cc;
                        rr = arcr;
                        string[] va = item.Split('.');
                        //eDB rebarDB = MainRebarDB;
                        if (int.Parse(va[0]) == 5)
                        {
                            //rebarDB = eDB.DB28;
                            dd = 1500 - cc;
                            if (rebarDB == eDB.DB28)
                                dd = 1200 - cc;
                            if (va.Length == 1)
                                RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), 0, "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
                            else if (va.Length == 2)
                                RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[1]), "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
                            else if (va.Length == 3)
                                RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[1]), va[2], rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));

                        }
                        else
                        {
                            if (va.Length == 1)
                                RebarList.Add(new MKRebarRecord(int.Parse(va[0]), 0, "", MainRebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
                            else if (va.Length == 2)
                                RebarList.Add(new MKRebarRecord(int.Parse(va[0]), int.Parse(va[1]), "", MainRebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
                            else if (va.Length == 3)
                                RebarList.Add(new MKRebarRecord(int.Parse(va[0]), int.Parse(va[1]), va[2], MainRebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
                        }
                    }
                }
                else if (Lmax <= 24000)
                {
                    isDiv = true;
                    // 分三段,中间段12米
                    int L2 = 12000 - 45 + 32 - 2400;

                    double LConst = PierHeight - LenUpper - L2;
                    int aa = (int)Math.Round(LConst + FTHeight - 160 - B - mainDBdia, 0, MidpointRounding.AwayFromZero);
                    int bb = arcLength;// (int)Math.Round(arc.Length, 0, MidpointRounding.AwayFromZero);
                    int cc = arcC;// 305;
                    int dd = 1500 - arcC;// 1195;
                    if (MainRebarDB == eDB.DB28)
                        dd = 1200 - arcC;
                    int rr = arcR;// (int)Math.Round(arc.Radius, 0, MidpointRounding.AwayFromZero);
                    foreach (var item in dicRInfo.Keys)
                    {
                        value = dicRInfo[item];
                        int arcr = value[0];
                        bb = value[1];
                        cc = value[2];
                        int arcnum = value[3];
                        dd = 1500 - cc;
                        if (MainRebarDB == eDB.DB28)
                            dd = 1200 - arcC;
                        rr = arcr;
                        string[] va = item.Split('.');
                        //eDB rebarDB = MainRebarDB;
                        if (int.Parse(va[0]) == 5)
                        {
                            //rebarDB = eDB.DB28;
                            dd = 1500 - cc;
                            if (rebarDB == eDB.DB28)
                                dd = 1200 - cc;
                            if (va.Length == 1)
                                RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), 0, "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
                            else if (va.Length == 2)
                                RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[2]), "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
                            else if (va.Length == 3)
                                RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[2]), va[2], rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));

                        }
                        else
                        {
                            if (va.Length == 1)
                                RebarList.Add(new MKRebarRecord(int.Parse(va[0]), 0, "", MainRebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
                            else if (va.Length == 2)
                                RebarList.Add(new MKRebarRecord(int.Parse(va[0]), int.Parse(va[1]), "", MainRebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
                            else if (va.Length == 3)
                                RebarList.Add(new MKRebarRecord(int.Parse(va[0]), int.Parse(va[1]), va[2], MainRebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
                        }
                    }

                    RebarList.Add(new MSZRebarRecord(6, 0, "", MainRebarDB, NumMainAll, eShapeType.MSZ, L2 + 1200 * 2));
                }
                else if (Lmax <= 36000)
                {
                    // 分三段
                    throw new NotImplementedException("分四段逻辑没写");

                }
            }

            #endregion



            #region UBlot数量计算
            if (isToTop)
            {
                UAN1N2 = 0;
            }
            else
            {
                if (isDiv)
                    UAN1N2 = NumMainAll * 8;
                else
                    UAN1N2 = NumMainAll * 4;
            }
            #endregion
        }
        #region 废弃
        //public override void SetRebarList()
        //{
        //    #region 0-箍筋
        //    int npts = GetStirrupNum();

        //    int a = 0, b = 0, c = 0;
        //    //1号筋
        //    CalPara(Width, Length, wwSide, llSide, ref a, ref b, ref c);
        //    RebarList.Add(new MRORebarRecord(1, 0, "", eDB.DB12, npts, eShapeType.MRO, a, b, c));
        //    //箍筋变化筋数量
        //    int num = (int)LenUpper / 300;

        //    for (int m = 1; m <= num; m++)
        //    {
        //        double r1 = 0;
        //        double r0 = 0;
        //        CalArcCenter(1750 - 700, 0, 0, 3000, OuterRadius, 300 * m, ref r1);
        //        CalArcCenter(1750 - 700 + wwSide, 0, 0, 3000, InnerRadius, 300 * m, ref r0);

        //        double r2 = 0;
        //        CalArcCenter(450 - llSide , 0, 0, 3000, SideRadius, 300 * m, ref r2);
        //        double w = 3500 - 2 * r1;
        //        double ww = 3500 - 2 * r0;
        //        double wwS = (w - ww) * 0.5;
        //        //CalPara(Width, w, Math.Round(r2, 0, MidpointRounding.AwayFromZero), Math.Round(llS, 0, MidpointRounding.AwayFromZero), ref a, ref b, ref c);
        //        CalPara(w, Length, Math.Round(wwS, 0, MidpointRounding.AwayFromZero), Math.Round(r2, 0, MidpointRounding.AwayFromZero), ref a, ref b, ref c);

        //        RebarList.Add(new MRORebarRecord(1, m, "", eDB.DB12, 1, eShapeType.MRO, a, b, c));
        //    }

        //    //2号筋
        //    RebarList.Add(new MORebarRecord(2, 0, "", eDB.DB12, npts, eShapeType.MO, Width - 100 - 24, (int)MainLBarDistribute.Location[1] * -2 + 12));
        //    int tmpn = 0;
        //    int tmp2 = 2;
        //    switch (SubType)
        //    {
        //        case eSubType.A:
        //            tmpn = 3;
        //            tmp2 = 1;
        //            break;
        //        case eSubType.B:
        //        case eSubType.C:
        //            tmpn = 2;
        //            tmp2 = 5;
        //            break;
        //        case eSubType.D:
        //            tmpn = 3;
        //            tmp2 = 1;
        //            break;
        //    }

        //    RebarCollection RebarList3a = new RebarCollection();//3a集合
        //    RebarCollection RebarList3b = new RebarCollection();//3b集合
        //    for (int m = 1; m <= num; m++)
        //    {
        //        double r1 = 0;
        //        double r0 = 0;
        //        CalArcCenter(1750 - 700, 0, 0, 3000, OuterRadius, 300 * m, ref r1);
        //        CalArcCenter(1750 - 700 + wwSide, 0, 0, 3000, InnerRadius, 300 * m, ref r0);

        //        double r2 = 0;
        //        CalArcCenter(450 - llSide, 0, 0, 3000, SideRadius, 300 * m, ref r2);
        //        double w = 3500 - 2 * r1;
        //        double ww = 3500 - 2 * r0;
        //        double wwS = (w - ww) * 0.5;
        //        if (m == 10)
        //        {
        //            r2 = 0;
        //            wwS = 0;
        //            tmpn = 4;
        //            tmp2 = 7;
        //            SetRebarDistributeIV( w - 50 * 2 , Length - 50 * 2, wwS, r2);
        //            RebarList3a.Add(new MORebarRecord(3, m, "a", eDB.DB12, 1, eShapeType.MO, Length - 100 - 24, MainWBarDistribute.Distance(tmp2, 10) + 12));
        //            RebarList3b.Add(new MORebarRecord(3, m, "b", eDB.DB12, 2, eShapeType.MO, Length - 100 - 24, MainWBarDistribute.Distance(tmpn, 6) + 12));

        //        }
        //        else
        //        {
        //            SetRebarDistributeIII( w, Length, wwS, r2);

        //            RebarList3a.Add(new MORebarRecord(3, m, "a", eDB.DB12, 1, eShapeType.MO, Length - 100 - 24, MainWBarDistribute.Distance(tmp2, 8) + 12));
        //            RebarList3b.Add(new MORebarRecord(3, m, "b", eDB.DB12, 2, eShapeType.MO, Length - 100 - 24, MainWBarDistribute.Distance(tmpn, 4) + 12));
        //        }
        //        RebarList.Add(new MORebarRecord(2, m, "", eDB.DB12, npts, eShapeType.MO, (int)w - 100 - 24, (int)MainLBarDistribute.Location[1] * -2 + 12 ));
        //    }

        //    SetRebarDistribute();
        //    RebarList.Add(new MORebarRecord(3, 0, "", eDB.DB12, npts * 2, eShapeType.MO, Length - 100 - 24, MainWBarDistribute.Distance(1, 2) + 12*2));

        //    foreach (var item in RebarList3a)
        //    {
        //        RebarList.Add(item);
        //    }
        //    foreach (var item in RebarList3b)
        //    {
        //        RebarList.Add(item);
        //    }
        //    #endregion

        //    #region 主筋  
        //    bool isDiv = false;
        //    bool isToTop = false;
        //    //  1-获取承台尺寸
        //    FootingBase theFooting = MemberFactory.CreatMember(MemberFactory.FromColumnToFooting(ColumnType), SubType);
        //    int FTHeight = theFooting.Height;
        //    int FTWidth = theFooting.Width;
        //    int FTLen = theFooting.Length;
        //    int db = (int)MainRebarDB;
        //    //  2-确定分段
        //    // 起步钢筋距承台底面160；
        //    double x0 = TopLength * 0.5 - 0.5 * Width + mainDBdia * 0.5 + 50 + 12;
        //    double x1 = GetXByH(1.5) * 1000 + mainDBdia * 0.5 + 50 + 12;
        //    double x2 = 0;


        //    PEArc OuterArc = new PEArc(new Point2D(x0, 0), new Point2D(x1, 1500), new Point2D(x2, 3000 - 50 - mainDBdia * 0.5 - 12));
        //    //double Lmax = 1200 + OuterArc.Length + (PierHeight - LenUpper) + (FTHeight - 160) + 600 - 3 * mainDBdia;

        //    int[] value = dicRInfo.Values.ToList()[0];

        //    int arcR = value[0];
        //    int arcLength = value[1];
        //    int arcC = value[2];
        //    int arcNum = value[3];
        //    double Lmax = 1500 + arcLength + (PierHeight - LenUpper) + (FTHeight - 160) + 600 - 3 * mainDBdia;

        //    int NumMainAll = 0;
        //    if (Lmax <= 12000)
        //    {
        //        isToTop = true;
        //        foreach (var item in dicRInfo.Keys)
        //        {
        //            value = dicRInfo[item];
        //            int arcr = value[0];
        //            int arclength = value[1];
        //            int arcc = value[2];
        //            int arcnum = value[3];
        //            int rr = RebarKnowledge.GerRadius(eDB.DB32);
        //            int l = (int)((PierHeight - LenUpper) + (FTHeight - 160 - rr * 0.5));
        //            int A = 600;        //固定      
        //            int B = 45;         //固定
        //            int F = 1500 - arcc;
        //            string[] va = item.Split('.');
        //            eDB rebarDB = MainRebarDB;
        //            rr = arcr;
        //            if (int.Parse(va[0]) == 5)
        //            {
        //                rebarDB = eDB.DB28;
        //                value = dicRInfo[item];

        //                int bb = arclength;
        //                int cc = arcc;
        //                //int arcnum = value[3];
        //                int dd = 1200 - cc;

        //                F = 1200 - arcc;
        //                if (va.Length == 1)
        //                    RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), 0, "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
        //                else if (va.Length == 2)
        //                    RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[2]), "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
        //                else if (va.Length == 3)
        //                    RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[2]), va[2], rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));

        //            }
        //            else
        //            {
        //                if (va.Length == 1)
        //                    RebarList.Add(new MKLRebarRecord(int.Parse(va[0]), 0, "", rebarDB, arcnum, eShapeType.MKL, A, l, arclength, arcc, F));
        //                else if (va.Length == 2)
        //                    RebarList.Add(new MKLRebarRecord(int.Parse(va[0]), int.Parse(va[1]), "", rebarDB, arcnum, eShapeType.MKL, A, l, arclength, arcc, F));
        //                else if (va.Length == 3)
        //                    RebarList.Add(new MKLRebarRecord(int.Parse(va[0]), int.Parse(va[1]), va[2], rebarDB, arcnum, eShapeType.MKL, A, l, arclength, arcc, F));
        //            }
        //        }
        //    }
        //    else
        //    {

        //        int NumOFout = MainLBarDistribute.Location.Count * 2 + 4;
        //        NumMainAll = MainWBarDistribute.Location.Count * 2 + NumOFout;
        //        // 判断起步筋定尺7m或9m，判断依据是花瓶主筋的A值应不小于2400
        //        double LStartMax = 600 + (PierHeight - LenUpper + (FTHeight - 160) - 3 * mainDBdia);
        //        double L1 = 8483;
        //        int len = 9000;
        //        if (LStartMax > 9000)
        //        {
        //            // 起步筋定尺9m
        //            //4.1a为内侧起步筋；
        //            RebarList.Add(new MHXRebarRecord(4, 1, "", MainRebarDB, false, NumOFout - 4, eShapeType.MHXe, 9000));

        //            RebarList.Add(new MHXRebarRecord(4, 2, "", MainRebarDB, true, NumMainAll - NumOFout, eShapeType.MHX, 9000));
        //            //5.1b为外侧起步筋；
        //            RebarList.Add(new MHXRebarRecord(4, 3, "", MainRebarDB, true, 4, eShapeType.MHX, 9000));
        //        }
        //        else if (LStartMax > 7000)
        //        {
        //            // 起步筋定尺7m
        //            //4.1a为内侧起步筋；
        //            RebarList.Add(new MHXRebarRecord(4, 1, "", MainRebarDB, false, NumOFout - 4, eShapeType.MHXe, 7000));

        //            RebarList.Add(new MHXRebarRecord(4, 2, "", MainRebarDB, true, NumMainAll - NumOFout, eShapeType.MHX, 7000));
        //            //5.1b为外侧起步筋；
        //            RebarList.Add(new MHXRebarRecord(4, 3, "", MainRebarDB, true, 4, eShapeType.MHX, 7000));
        //            len = 7000;
        //            L1 = 6483;
        //        }
        //        else if (LStartMax >= 600 + 2400 + (FTHeight - 160) - 3 * mainDBdia)
        //        {
        //            // 起步筋搭接位置不合适
        //            throw new Exception("起步筋搭接位置不合适，花瓶墩过矮");
        //        }
        //        int A = 600;        //固定      
        //        int C = 45;         //固定
        //        int D = 2400;       //固定
        //        int L = len;       //固定
        //        int r = RebarKnowledge.GerRadius(MainRebarDB);
        //        int d = 32;
        //        int B = L - A - C - D + r / 2 + d;
        //        Lmax = 1500 + OuterArc.Length + (PierHeight - LenUpper) + (FTHeight - 160) - L1 + 1200;
        //        if (Lmax <= 12000)
        //        {

        //            // 分两段
        //            double LConst = PierHeight - LenUpper;
        //            int aa = (int)Math.Round(LConst + FTHeight - 160 - B - mainDBdia, 0, MidpointRounding.AwayFromZero);
        //            int bb = arcLength;// (int)Math.Round(arc.Length, 0, MidpointRounding.AwayFromZero);
        //            int cc = arcC;// 305;
        //            int dd = 1500 - arcC;// 1195;
        //            int rr = arcR;// (int)Math.Round(arc.Radius, 0, MidpointRounding.AwayFromZero);
        //            foreach (var item in dicRInfo.Keys)
        //            {
        //                value = dicRInfo[item];
        //                int arcr = value[0];
        //                bb = value[1];
        //                cc = value[2];
        //                int arcnum = value[3];
        //                dd = 1500 - cc;
        //                rr = arcr;
        //                string[] va = item.Split('.');
        //                eDB rebarDB = MainRebarDB;
        //                if (int.Parse(va[0]) == 5)
        //                {
        //                    rebarDB = eDB.DB28;
        //                    dd = 1200 - cc;
        //                    if (va.Length == 1)
        //                        RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), 0, "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
        //                    else if (va.Length == 2)
        //                        RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[1]), "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
        //                    else if (va.Length == 3)
        //                        RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[1]), va[2], rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));

        //                }
        //                else
        //                {
        //                    if (va.Length == 1)
        //                        RebarList.Add(new MKRebarRecord(int.Parse(va[0]), 0, "", rebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
        //                    else if (va.Length == 2)
        //                        RebarList.Add(new MKRebarRecord(int.Parse(va[0]), int.Parse(va[1]), "", rebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
        //                    else if (va.Length == 3)
        //                        RebarList.Add(new MKRebarRecord(int.Parse(va[0]), int.Parse(va[1]), va[2], rebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
        //                }
        //            }
        //        }
        //        else if (Lmax <= 24000)
        //        {
        //            isDiv = true;
        //            // 分三段,中间段12米
        //            int L2 = 12000 - 45 + 32 - 2400;

        //            double LConst = PierHeight - LenUpper - L2;
        //            int aa = (int)Math.Round(LConst + FTHeight - 160 - B - mainDBdia, 0, MidpointRounding.AwayFromZero);
        //            int bb = arcLength;// (int)Math.Round(arc.Length, 0, MidpointRounding.AwayFromZero);
        //            int cc = arcC;// 305;
        //            int dd = 1500 - arcC;// 1195;
        //            int rr = arcR;// (int)Math.Round(arc.Radius, 0, MidpointRounding.AwayFromZero);
        //            foreach (var item in dicRInfo.Keys)
        //            {
        //                value = dicRInfo[item];
        //                int arcr = value[0];
        //                bb = value[1];
        //                cc = value[2];
        //                int arcnum = value[3];
        //                dd = 1500 - cc;
        //                rr = arcr;
        //                string[] va = item.Split('.');
        //                eDB rebarDB = MainRebarDB;
        //                if (int.Parse(va[0]) == 5)
        //                {
        //                    rebarDB = eDB.DB28;
        //                    dd = 1200 - cc;
        //                    if (va.Length == 1)
        //                        RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), 0, "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
        //                    else if (va.Length == 2)
        //                        RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[2]), "", rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));
        //                    else if (va.Length == 3)
        //                        RebarList.Add(new MKRRebarRecord(int.Parse(va[0]), int.Parse(va[2]), va[2], rebarDB, arcnum, eShapeType.MKR, bb, cc, dd, rr));

        //                }
        //                else
        //                {
        //                    if (va.Length == 1)
        //                        RebarList.Add(new MKRebarRecord(int.Parse(va[0]), 0, "", rebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
        //                    else if (va.Length == 2)
        //                        RebarList.Add(new MKRebarRecord(int.Parse(va[0]), int.Parse(va[1]), "", rebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
        //                    else if (va.Length == 3)
        //                        RebarList.Add(new MKRebarRecord(int.Parse(va[0]), int.Parse(va[1]), va[2], rebarDB, arcnum, eShapeType.MK, aa, bb, cc, dd, rr));
        //                }
        //            }

        //            RebarList.Add(new MSZRebarRecord(6, 0, "", MainRebarDB, NumMainAll, eShapeType.MSZ, L2 + 1200 * 2));
        //        }
        //        else if (Lmax <= 36000)
        //        {
        //            // 分三段
        //            throw new NotImplementedException("分四段逻辑没写");

        //        }
        //    }
        //    ;
        //    ////  1-获取承台尺寸
        //    //FootingBase theFooting = MemberFactory.CreatMember(MemberFactory.FromColumnToFooting(ColumnType), SubType);
        //    //int FTHeight = theFooting.Height;
        //    //int FTWidth = theFooting.Width;
        //    //int FTLen = theFooting.Length;
        //    //int db = (int)MainRebarDB;
        //    ////  2-确定分段
        //    //// 起步钢筋距承台底面160；
        //    //double x0 = TopLength*0.5 - 0.5 * Width + mainDBdia * 0.5 + 50 + 12;
        //    //double x1=GetXByH(1.5)*1000+ mainDBdia * 0.5 + 50 + 12;
        //    //double x2 = 0;
        //    //PEArc OuterArc = new PEArc(new Point2D(x0, 0), new Point2D(x1, 1500), new Point2D(x2, 3000));
        //    //double Lmax = 1200 + OuterArc.Length+(PierHeight-LenUpper)+(FTHeight-160)+600-3*mainDBdia;
        //    //if (Lmax<=12000)
        //    //{
        //    //    ;// 分一段
        //    //}
        //    //else
        //    //{
        //    //    int NumOFout = MainLBarDistribute.Location.Count * 2 + 4;
        //    //    int NumMainAll = MainWBarDistribute.Location.Count * 2 + NumOFout;
        //    //    // 判断起步筋定尺7m或9m，判断依据是花瓶主筋的A值应不小于2400
        //    //    double LStartMax = 600 + (PierHeight - LenUpper + (FTHeight - 160) - 3 * mainDBdia);
        //    //    double L1 = 8483;
        //    //    if (LStartMax>9000)
        //    //    {
        //    //        // 起步筋定尺9m
        //    //        //4.1a为内侧起步筋；
        //    //        RebarList.Add(new MHXRebarRecord(4, 1, "a", MainRebarDB, true, NumMainAll - NumOFout, eShapeType.MHX));
        //    //        //5.1b为外侧起步筋；
        //    //        RebarList.Add(new MHXRebarRecord(4, 1, "b", MainRebarDB, false, NumOFout, eShapeType.MHXe));
        //    //    }
        //    //    else if (LStartMax>7000)
        //    //    {
        //    //        // 起步筋定尺7m
        //    //        //4.1a为内侧起步筋；
        //    //        RebarList.Add(new MHXRebarRecord(4, 1, "a", MainRebarDB, true, NumMainAll - NumOFout, eShapeType.MHX,7000));
        //    //        //5.1b为外侧起步筋；
        //    //        RebarList.Add(new MHXRebarRecord(4, 1, "b", MainRebarDB, false, NumOFout, eShapeType.MHXe,7000));
        //    //        L1 = 6483;
        //    //    }
        //    //    else if (LStartMax>=600+2400+ (FTHeight - 160) - 3 * mainDBdia)
        //    //    {
        //    //        // 起步筋搭接位置不合适
        //    //        throw new Exception("起步筋搭接位置不合适，花瓶墩过矮");
        //    //    }

        //    //    Lmax = 1200 + OuterArc.Length + (PierHeight - LenUpper) + (FTHeight - 160) -L1+1200;
        //    //    if (Lmax<=12000)
        //    //    {
        //    //        // 分两段
        //    //        double LConst = PierHeight - LenUpper;
        //    //        int aa = (int)Math.Round(LConst + FTHeight - 160 - L1 + 1200, 0, MidpointRounding.AwayFromZero);
        //    //        var arc = new PEArc(
        //    //            new Point2D(0.5 * Width - 50 - 12 - 0.5 * mainDBdia, 0),
        //    //            new Point2D(GetXByH(0.5 * LenUpper*1e-3)*1000 - 50 - 12 - 0.5 * mainDBdia,0.5*LenUpper),
        //    //            new Point2D(0.5 * TopLength - 50 - 12 - 0.5 * mainDBdia, LenUpper)
        //    //            );
        //    //        int bb= (int)Math.Round(arc.Length, 0, MidpointRounding.AwayFromZero);
        //    //        int cc = 305;
        //    //        int dd = 1195;
        //    //        int rr = (int)Math.Round(arc.Radius, 0, MidpointRounding.AwayFromZero);
        //    //        RebarList.Add(new MKRebarRecord(4, 2, "a", MainRebarDB, MainLBarDistribute.Location.Count * 2, eShapeType.MK, aa, bb, cc, dd, rr));
        //    //    }
        //    //    else if (Lmax<=24000)
        //    //    {
        //    //        // 分三段
        //    //        throw new NotImplementedException("分三段逻辑没写");

        //    //    }
        //    //}
        //    //;
        //    #endregion



        //    #region UBlot数量计算
        //    if (isToTop)
        //    {
        //        UAN1N2 = 0;
        //    }
        //    else
        //    {
        //        if (isDiv)
        //            UAN1N2 = NumMainAll * 8;
        //        else
        //            UAN1N2 = NumMainAll * 4;
        //    }
        //    #endregion
        //}

        #endregion
    }

}
